$(document).ajaxStart(function(){
    NProgress.configure({
        minimum:0.3
    });
    NProgress.configure({ showSpinner: false });
    NProgress.start() ;
})

$(document).ajaxStop(function(){
    setInterval(function(){
        NProgress.done() 
    },500)
})

$(function () {

    // 侧边栏菜单动画
    $(".asideMenu a").click(function () {
        $(".asideMenu a").removeClass("active");
        $(this).addClass("active");
    })

    //侧边栏二级菜单动画

    $(".menuSlide").click(function () {
        $(".classif").slideToggle();
    })

    // 侧边栏隐藏显示动画
    $(".toLeft").click(function () {
        $(".left,.main").toggleClass("activeLeft");
    })

    //是否登录判断
    $.ajax({
        url: "/employee/checkRootLogin",
        type: "GET",
        data: {},
        success: function (callback) {
            // console.log(callback);
            if (callback.error) {
                window.location.href = "login.html"
            }
        }
    })

    // 登出模态框
    $(".myModalBox").click(function () {
        $('#myModal').modal("show")
    });

    //登出
    $("#logOut").click(function () {
        $.ajax({
            url: "/employee/employeeLogout",
            type: "GET",
            data: {},
            success: function (callback) {
                if (callback.success) {
                    window.sessionStorage.setItem("href", window.location.href);
                    window.location.href = "login.html";
                }
            }
        })
    })
   
})